import React, { useContext } from "react";
import icon from "./assets/nodata.svg";
import { ThemeContext } from "../theme";
import { useStyles } from "./styles";
import { NoDataProps } from "./type";

export default function NoData({ description = "暂无数据" }: NoDataProps) {
  const { fontSize } = useContext(ThemeContext);
  const classes = useStyles({ fontSize });
  return (
    <div className={classes.noData} role="ct0-noData">
      <img src={icon} className={classes.icon} />
      <span className={classes.text}>{description}</span>
    </div>
  );
}
